home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-06-25 | 1.6 KB | 41 lines | [TEXT/CWIE] |
- Out Of Context Menus
- by Eric Traut
- 1999 MacHack Programming Contest
-
-
- Out Of Context Menus is an application (built using PowerPlant) that
- adds out-of-place contextual menu items to the Finder.
-
- To use: Run "OutOfContext". Flip to the Finder, and control-click on
- one of the windows. Try out the various options.
-
- Explanation of code: The code consists of a jGNEFilter (which hooks
- in and runs at Get/WaitNextEvent time). It waits for the Finder to
- be the front process and then begins to filter events - including
- control-click events. While the Finder is the front-most app, it
- also attempts to maintain a list of "CShadowWindow" objects which
- mirror the windows in the Finder's window list. Each window in the
- shadow window list can have an attached "behavior". Each behavior
- corresponds to a single contextual menu item. For example, one
- causes all data drawn to the Finder window to be displayed in a
- blurred fashion. This is accomplished by patching the QuickDraw
- bottleneck procs for the window.
-
- The only other scary part of the program is a trap patch on
- WaitNextEvent that is applied within the Finder's context. The
- reason for this patch is that the Finder calls WNE with a sleep
- time of 60 ticks. This is generally good for other apps in the
- system. But it is not good for windows being animated by OutOfContext.
- The patch simply replaces the 60-tick sleep time with a time of
- one tick.
-
- All of this code is considered "public domain" and can be used for
- any purpose - evil or otherwise. The author, however, is not
- responsible for any loss of data, hair, money or anything else
- resulting from the execution of this program or the use of the
- included code.
-
-
-
-
-